package ArithmeticLibrary.Sets;

import ArithmeticLibrary.Elements.ElementField;
import ByteTree.ByteTree;

/**
 * this class represents a general field
 * 
 * @author Lea Golan
 *
 */
public abstract class Field {

	/**
	 * Checks if the specified element is in the field.
	 * 
	 * @param element - an element of a field
	 * @return true iff the element belongs to this field
	 */
	public abstract boolean belong(ElementField element);	
	
	/**
	 * Compare this to obj
	 */
	public abstract boolean equals(java.lang.Object obj); 
	
	/**
	 * Creates a new Field element by encoding message into the field.
	 * 
	 * @param message - a byte tree representing an element
	 * @return a new ElementField according to parameters extracted from message
	 * @throws Exception - if the byte tree is not appropriately formatted 
	 */
	public abstract ElementField createElement(ByteTree message) throws Exception;
	
	/**
	 * @return the unit element of the Field
	 */
	public abstract ElementField getFieldIdentityElement();
	
	/**
	 * @return the prime order of the field
	 */
	public abstract java.math.BigInteger getOrder();
	
}
